package com.miyake.loveviewweb.server.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-07-11 14:41:10")
/** */
public final class FolderModelMeta extends org.slim3.datastore.ModelMeta<com.miyake.loveviewweb.shared.model.FolderModel> {

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, java.lang.Integer> columns = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, java.lang.Integer>(this, "columns", "columns", int.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel> folderName = new org.slim3.datastore.StringAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel>(this, "folderName", "folderName");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key> owner = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key>(this, "owner", "owner", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key> parent = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, com.google.appengine.api.datastore.Key>(this, "parent", "parent", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<com.miyake.loveviewweb.shared.model.FolderModel, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final FolderModelMeta slim3_singleton = new FolderModelMeta();

    /**
     * @return the singleton
     */
    public static FolderModelMeta get() {
       return slim3_singleton;
    }

    /** */
    public FolderModelMeta() {
        super("FolderModel", com.miyake.loveviewweb.shared.model.FolderModel.class);
    }

    @Override
    public com.miyake.loveviewweb.shared.model.FolderModel entityToModel(com.google.appengine.api.datastore.Entity entity) {
        com.miyake.loveviewweb.shared.model.FolderModel model = new com.miyake.loveviewweb.shared.model.FolderModel();
        model.setColumns(longToPrimitiveInt((java.lang.Long) entity.getProperty("columns")));
        model.setFolderName((java.lang.String) entity.getProperty("folderName"));
        model.setKey(entity.getKey());
        model.setOwner((com.google.appengine.api.datastore.Key) entity.getProperty("owner"));
        model.setParent((com.google.appengine.api.datastore.Key) entity.getProperty("parent"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("columns", m.getColumns());
        entity.setProperty("folderName", m.getFolderName());
        entity.setProperty("owner", m.getOwner());
        entity.setProperty("parent", m.getParent());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        com.miyake.loveviewweb.shared.model.FolderModel m = (com.miyake.loveviewweb.shared.model.FolderModel) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        writer.setNextPropertyName("columns");
        encoder0.encode(writer, m.getColumns());
        if(m.getFolderName() != null){
            writer.setNextPropertyName("folderName");
            encoder0.encode(writer, m.getFolderName());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getOwner() != null){
            writer.setNextPropertyName("owner");
            encoder0.encode(writer, m.getOwner());
        }
        if(m.getParent() != null){
            writer.setNextPropertyName("parent");
            encoder0.encode(writer, m.getParent());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected com.miyake.loveviewweb.shared.model.FolderModel jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        com.miyake.loveviewweb.shared.model.FolderModel m = new com.miyake.loveviewweb.shared.model.FolderModel();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("columns");
        m.setColumns(decoder0.decode(reader, m.getColumns()));
        reader = rootReader.newObjectReader("folderName");
        m.setFolderName(decoder0.decode(reader, m.getFolderName()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("owner");
        m.setOwner(decoder0.decode(reader, m.getOwner()));
        reader = rootReader.newObjectReader("parent");
        m.setParent(decoder0.decode(reader, m.getParent()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}